<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>上传重要文献数据</title>
    <%@ include file="/WEB-INF/include/commoncss.jsp"%>
    <script type="text/javascript"
            src="${ctx}/javascript/laydate/laydate.js"></script>
</head>
<body>

<div action="" class="form form-horizontal" id="scheduleAdd">

    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span
                class="c-red">*</span>选择地区：</label>
        <div class="formControls col-xs-8 col-sm-3">
                <span class="select-box">
                    <select class="select" id="address_type" name="address_type">
                   <option value="亚洲">亚洲</option>
                   <option value="非洲">非洲</option>
                   <option value="欧洲">欧洲</option>
                   <option value="拉丁美洲">拉丁美洲</option>
                   <option value="北美洲">北美洲</option>
                   <option value="大洋洲">大洋洲</option>
                    </select>
                </span>
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span
                class="c-red">*</span>选择文件类型：</label>
        <div class="formControls col-xs-8 col-sm-3">
                <span class="select-box">
                    <select class="select" id="file_type" name="file_type">
                   <option value="人口">人口</option>
                   <option value="劳动与就业">劳动与就业</option>
                   <option value="贫困与收入">贫困与收入</option>
                   <option value="教育">教育</option>
                   <option value="卫生">卫生</option>
                   <option value="能源生产与使用">能源生产与使用</option>
                   <option value="经济">经济</option>
                   <option value="贸易">贸易</option>
                   <option value="政府财政">政府财政</option>
                   <option value="货币">货币</option>
                   <option value="投资环境">投资环境</option>
                   <option value="金融">金融</option>
                   <option value="交通和通讯">交通和通讯</option>
                   <option value="信息科技">信息科技</option>
                    </select>
                </span>
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span
                class="c-red">*</span>按洲上传文件：</label>
        <%--//带文本框--%>
        <div class="formControls">
        <span class="btn-upload form-group" style="margin-left: 15px;">
                <input class="input-text upload-url radius" type="text" name="uploadfile-1" id="uploadfile-1" readonly><a  class="btn btn-primary radius"><i class="Hui-iconfont">&#xe642;</i> 选择文件</a>
               <input type="file" name="file-1" class="input-file" id="uploadFiles">
        </span>
        </div>
    </div>
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-5"><span style="color:#999999;font-size: 16px;"><span class="c-red">*</span>(命名规范：internationalData.zip，EXCEL文件命名必须符合规范，如果命名不规范会导致上传失败)</span></label>
    </div>

    <div class="row cl">
        <button value="" type="button" class="btn btn-success radius" style="width: 20%;margin-left: 55px;background-color: #6495ED;border-color: #6495ED;" onClick="update_files()">上传</button>
    </div>
</div>
<%@ include file="/WEB-INF/include/commonjs.jsp"%>

<script>
    function update_files(){
        var address_type=$("#address_type").val();
        var file_type=$("#file_type").val();

        var formData=new FormData();
        formData.append("address_type",address_type);
        formData.append("file_type",file_type);
        formData.append("document",$("#uploadFiles")[0].files[0]);
        var url="${ctx}/literatureData/uploadLiteratureData.do";
        $.ajax({
            url:url,
            type:"post",
            data: formData,
            async:false,
            xhrFields: {
                withCredentials: true
            },
            scriptCharset: 'utf-8',
            success:function (data) {
                if(data=="添加成功"){
                    layer.msg(data,{icon:1,time:2000},function(){
                        parent.location.reload(true);
                    })
                }else{
                    layer.msg(data,{icon:2,time:2000});
                }
            },
            error:function (data) {
                alert("服务器处理失败！");
            }
        })//ajax
    }
</script>
</article>
</body>

</html>